-
Notifications
You must be signed in to change notification settings - Fork 431
feat(*): introduce /types subpath exports #7644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: faedec2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
📝 WalkthroughWalkthroughThis pull request adds a 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In @.changeset/types-subpath-export.md:
- Line 15: Add TypeScript resolution tests that import from each new "/types"
subpath (e.g., "@clerk/react/types", "@clerk/nextjs/types", and re-exports from
"@clerk/shared/types") to verify declarations are published and resolvable;
create TypeScript-only test files (or tsd tests) that do statements like "import
type { UserResource } from '@clerk/react/types'" and use tsd's expectType or a
tsc compile check to ensure the types are present; place these tests under the
repo's type-tests area or each SDK package's test suite and wire them into CI so
the build fails if the "/types" entrypoints or re-exports break.
In `@packages/express/package.json`:
- Around line 46-55: The "./types" export paths in package.json are wrong for
tsup's output; update the "./types" export block so both "import" and "require"
entries point to dist/types/index.* files (i.e., use "./dist/types/index.d.mts"
and "./dist/types/index.mjs" for import, and "./dist/types/index.d.ts" and
"./dist/types/index.js" for require) so the export matches tsup's types:
'./src/types/index.ts' entry output.
| '@clerk/chrome-extension': minor | ||
| --- | ||
|
|
||
| Add `/types` subpath export to re-export types from `@clerk/shared/types` along with SDK-specific types. This allows importing Clerk types directly from the SDK package (e.g., `import type { UserResource } from '@clerk/react/types'`) without needing to install `@clerk/types` as a separate dependency. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add tests for the new /types export surfaces.
No tests were added or updated; please add coverage to ensure each new /types entry resolves and type declarations are published correctly.
🤖 Prompt for AI Agents
In @.changeset/types-subpath-export.md at line 15, Add TypeScript resolution
tests that import from each new "/types" subpath (e.g., "@clerk/react/types",
"@clerk/nextjs/types", and re-exports from "@clerk/shared/types") to verify
declarations are published and resolvable; create TypeScript-only test files (or
tsd tests) that do statements like "import type { UserResource } from
'@clerk/react/types'" and use tsd's expectType or a tsc compile check to ensure
the types are present; place these tests under the repo's type-tests area or
each SDK package's test suite and wire them into CI so the build fails if the
"/types" entrypoints or re-exports break.
| "./types": { | ||
| "import": { | ||
| "types": "./dist/types.d.mts", | ||
| "default": "./dist/types.mjs" | ||
| }, | ||
| "require": { | ||
| "types": "./dist/types.d.ts", | ||
| "default": "./dist/types.js" | ||
| } | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
cat packages/express/tsup.config.tsRepository: clerk/javascript
Length of output: 624
Fix export paths to match tsup output.
The ./types export paths don't match the tsup configuration output. With types: './src/types/index.ts' as an entry, tsup outputs to dist/types/index.*, not dist/types.*. Update the export to:
"./types": {
"import": {
"types": "./dist/types/index.d.mts",
"default": "./dist/types/index.mjs"
},
"require": {
"types": "./dist/types/index.d.ts",
"default": "./dist/types/index.js"
}
}Without this fix, the export will fail at runtime.
🤖 Prompt for AI Agents
In `@packages/express/package.json` around lines 46 - 55, The "./types" export
paths in package.json are wrong for tsup's output; update the "./types" export
block so both "import" and "require" entries point to dist/types/index.* files
(i.e., use "./dist/types/index.d.mts" and "./dist/types/index.mjs" for import,
and "./dist/types/index.d.ts" and "./dist/types/index.js" for require) so the
export matches tsup's types: './src/types/index.ts' entry output.
a723733 to
a2fef7b
Compare
Why:
Developers currently need to install @clerk/types as a separate package
to access Clerk types. This adds friction and can cause version mismatches
between the types package and SDK.
What changed:
Added /types subpath export to 11 SDK packages that re-exports types from
@clerk/shared/types along with SDK-specific types. Developers can now import
types directly from their SDK:
import type { UserResource } from '@clerk/react/types'
Packages updated:
- @clerk/react
- @clerk/nextjs
- @clerk/tanstack-react-start
- @clerk/react-router
- @clerk/express
- @clerk/fastify
- @clerk/astro
- @clerk/nuxt
- @clerk/vue
- @clerk/expo
- @clerk/chrome-extension
a2fef7b to
4036653
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@packages/react-router/package.json`:
- Around line 53-58: The "./types" export currently points only to a .d.ts file
which prevents runtime code from being imported; update the package export map
entry for "./types" to follow the conditional export pattern used elsewhere by
replacing the string with an object that maps "types" to
"./dist/types/index.d.ts" and "default" (or the appropriate runtime key used in
other entries) to "./dist/types/index.js" so both type declarations and the
emitted runtime module are exposed (refer to the "./types" export key and the
emitted files dist/types/index.js and dist/types/index.d.ts to implement).
wobsoriano
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good!
Description
Fixes USER-4455
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.